home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 86
/
(Vol 86) My Disc.iso
/
Games
/
restaurante_1422.swf
/
scripts
/
__Packages
/
Main.as
< prev
Wrap
Text File
|
2009-04-29
|
5KB
|
152 lines
class Main extends MovieClip
{
function Main()
{
super();
this.chrono = new Chrono();
this.start = false;
this.fin = false;
this.xTab = [null,55,185,313,443,570,699];
}
function ini()
{
this.cache_mc.onRollOver = function()
{
this.useHandCursor = false;
};
this.cache_mc._visible = false;
this.cadeau._visible = false;
this.gateaux = [1,2,3,4,5,6];
this.gateau1.recette = [18,5,9,22];
this.gateau1.url = "MissDecouverte_Recette_BoulesCoco.pdf";
this.gateau2.recette = [23,1,14,12,8,13,15];
this.gateau2.url = "MissDecouverte_Recette_Chouquettes.pdf";
this.gateau3.recette = [17,23,12,1,18,4,6,21,15,20];
this.gateau3.url = "MissDecouverte_Recette_TarteChocolatNoisettes.pdf";
this.gateau4.recette = [4,23,1,16,15,12,3,14,2,19];
this.gateau4.url = "MissDecouverte_Recette_CookiesCacaoPepitesChocolat.pdf";
this.gateau5.recette = [23,1,12,10,8,15,14];
this.gateau5.url = "MissDecouverte_Recette_BriochePurBeurre.pdf";
this.gateau6.recette = [23,10,15,8,11,7];
this.gateau6.url = "MissDecouverte_Recette_PainEpice.pdf";
this.cakeMaker();
}
function cacheCadeau()
{
this.cadeau._visible = false;
this.cadeau.gotoAndStop(1);
}
function restart()
{
this.gateaux = [1,2,3,4,5,6];
this.gateau1.recette = [18,5,9,22];
this.gateau2.recette = [23,1,14,12,8,13,15];
this.gateau3.recette = [17,23,12,1,18,4,6,21,15,20];
this.gateau4.recette = [4,23,1,16,15,12,3,14,2,19];
this.gateau5.recette = [23,1,12,10,8,15,14];
this.gateau6.recette = [23,10,15,8,11,7];
this.start = false;
this.cache_mc._visible = false;
if(this.fin)
{
this.cadeau.tween(["_y","_alpha"],[this.cadeau._y - 10,0],0.2,"easeOutQuad",0,mx.utils.Delegate.create(this,this.cacheCadeau));
}
this.fin = false;
this.panneau_mc.tween(["_y","_alpha"],[49,0],0.3,"easeOutQuad");
this.fake_mc.setMask(this.masque_mc);
var _loc2_ = 1;
while(_loc2_ <= 6)
{
if(this["gateau" + _loc2_].bt_mc._currentframe > 1)
{
this["gateau" + _loc2_].bt_mc.gotoAndPlay("close");
}
this["gateau" + _loc2_].brightnessTo(-80,0.3);
this["gateau" + _loc2_].start();
_loc2_ = _loc2_ + 1;
}
this.suivant();
}
function cakeMaker()
{
this.panneau_mc.gotoAndStop(6);
this.id = Math.floor(Math.random() * this.gateaux.length);
this.panneau_mc.gotoAndStop(this.gateaux[this.id]);
this.panneau_mc.stopTween();
this["gateau" + this.gateaux[this.id]].ini();
this.remplissage.gotoAndStop(1);
var _loc2_ = 1;
while(_loc2_ <= 15)
{
var _loc3_ = _loc2_ * 0.04;
this["ingredient" + _loc2_].anim_mc.gotoAndStop(1);
if(_loc2_ != 15)
{
this["ingredient" + _loc2_].alphaTo(100,0.2,"easeInExpo",_loc3_);
}
else
{
this["ingredient" + _loc2_].alphaTo(100,0.2,"easeInExpo",_loc3_,mx.utils.Delegate.create(this,this.affichage));
}
_loc2_ = _loc2_ + 1;
}
}
function affichage()
{
this.panneau_mc.tween(["_y","_alpha"],[59,100],0.3,"easeInQuad");
this.fleche_mc.tween("_x",this.xTab[this.gateaux[this.id]],0.5);
this["gateau" + this.gateaux[this.id]].brightnessTo(0,0.3);
}
function suivant()
{
var _loc2_ = 1;
while(_loc2_ <= 15)
{
var _loc3_ = _loc2_ * 0.03;
this["ingredient" + _loc2_].anim_mc.gotoAndStop(1);
if(_loc2_ != 15)
{
this["ingredient" + _loc2_].alphaTo(0,0.2,"easeInExpo",_loc3_);
}
else
{
this["ingredient" + _loc2_].alphaTo(0,0.2,"easeInExpo",_loc3_,mx.utils.Delegate.create(this,this.cakeMaker));
}
_loc2_ = _loc2_ + 1;
}
}
function win()
{
this.fin = true;
this.chrono.stop();
this.cache_mc._visible = true;
this.cadeau._visible = true;
this.cadeau.gotoAndStop(2);
this.cadeau._alpha = 0;
this.cadeau.tween(["_y","_alpha"],[this.cadeau._y + 10,100],1);
this.fleche_mc.tween("_x",800,0.5);
var _loc2_ = 1;
while(_loc2_ <= 6)
{
this.setCakeLink(this["gateau" + _loc2_].bt_mc);
this["gateau" + _loc2_].bt_mc.play();
_loc2_ = _loc2_ + 1;
}
}
function setCakeLink(mc)
{
mc.onRollOver = mc.onDragOver = function()
{
this.gotoAndPlay("over");
};
mc.onRollOut = mc.onDragOut = function()
{
this.gotoAndPlay("out");
};
mc.onRelease = function()
{
this.getURL("PDF/" + this._parent.url,"_blank");
};
}
}